package org.example.demo10;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

//10.删除其中的100到第200行的数据
public class Test {
    public static void main(String[] args) throws IOException {
        BufferedReader reader=new BufferedReader(new FileReader("C:/out/1.txt"));
        List<String> list =new ArrayList<>();

        String a;
        while((a=reader.readLine())!=null){
                list.add(a);
            }

        reader.close();
        System.out.println(list);
        BufferedWriter writer= new BufferedWriter(new FileWriter("C:/out/1.txt"));
        int count=0;
        for(String b:list){
            if(count>100 && count<200){
                writer.write("\n");
            }else {
                writer.write(b+"\n");
            }
            count++;

        }

    }
}
